#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

int main()
{
    int fd=open("test.txt",O_WRONLY|O_CREAT,0666);
    if(fd<0){
    	printf("open file error\n");
	return 1;
    }
    //
    printf("fd:%d\n",fd);
    const char *mes="hello linux11111\n";
    write(fd,mes,strlen(mes));

    close(fd);
    return 0;
}

/*
int main()
{
    //chdir("/home/wu1");
    printf("Pid: %d\n",getpid());
    FILE *fp=fopen("log.txt","w");
    if(fp==NULL){
	perror("fopen");
	return 1;
    }
    //
    //
    const char *mes="hello linux";
    fwrite(mes,strlen(mes),1,fp);
    fclose(fp);

    //sleep(100);
    return 0;
}*/
